/**
 * @file
 * @author Ivan Babushkin (jogrms@gmail.com)
 * @date 13.06.2010
 */

#ifndef CMDEDIT_H
#define CMDEDIT_H

#include <QLineEdit>
#include <qodefault.h>
#include <QList>

class CmdEdit: public QLineEdit {
	Q_OBJECT

	public:

		CmdEdit(QWidget *parent = 0);
		~CmdEdit();

		void applySettings(struct QOSettings *settings);
		void saveHistory(QString fileName);
		void loadHistory(QString fileName);

	private:

		void showPreviousCommand();
		void showNextCommand();

		QStringList cmdList;
		QStringList::iterator cmdIterator;
		bool cmdModified;
		QString currentCmd;
		int historyCount;
		
	protected:

		void keyPressEvent(QKeyEvent *event);
		void showEvent(QShowEvent *event);
		
};

#endif // CMDEDIT_H
